package com.example.controller;

import com.example.common.Result;
import com.example.entity.SysEmployee;
import com.example.entity.SysStudent;
import com.example.service.SysEmployeeService;
import com.example.service.SysStudentService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class WebController {

    @Resource
    private SysEmployeeService sysEmployeeService;

    @Resource
    private SysStudentService sysStudentService;

    @PostMapping("/login")
    public Result login(@RequestBody SysEmployee sysEmployee) {
        SysEmployee dbemployee = sysEmployeeService.login(sysEmployee);
        return Result.success(dbemployee);
    }

    @PostMapping("/loginStudent")
    public Result loginStudent(@RequestBody SysStudent sysStudent) {
        SysStudent dbstudent = sysStudentService.login(sysStudent);
        return Result.success(dbstudent);
    }
}
